// 
// File:   processor.h
// Author: vileda
//
// Created on 22. Januar 2008, 01:02
//

#ifndef _PROCESSOR_H
#define	_PROCESSOR_H

#include <iostream>
#include <vector>
#include <map>
#include <bitset>
#include <string>
#include <stack>
#include <boost/smart_ptr.hpp>
#include "config.h"
#include "command.h"

class Processor
{
    static const unsigned short registerSize = 16;
    typedef std::bitset<16> vmc_register;
    typedef unsigned long int ul_int;

  public:
    Processor();
    ~Processor();
    bool setRegister(ul_int, vmc_register );
    vmc_register getRegister(ul_int);
    void push(vmc_register);
    vmc_register pop();
    void execute(std::string programFile);
    void addCommand(boost::shared_ptr<Command>);

  private:
    std::map<ul_int, vmc_register > memory;
    std::map<std::string, vmc_register> registers;
    std::stack<vmc_register > pstack;
    vmc_register bstemp;
    std::vector<boost::shared_ptr<Command> > code;
    void runCode();

};

#endif	/* _PROCESSOR_H */
